package com.zhiwei.msf.app.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.zhiwei.msf.app.dto.ProjectDto;
import com.zhiwei.msf.app.service.ProjectService;
import com.zhiwei.msf.app.vo.ProjectVo;
import com.zhiwei.msf.common.constant.ResultResponseMsg;
import com.zhiwei.msf.common.util.BeanConverterUtil;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 项目配置控制器
 *
 * @author zhiwei_yang
 * @time 2020-6-10-15:37
 */
@RestController
@RequestMapping("/project")
@Api("项目配置控制器")
public class ProjectController {

    @Autowired
    private ProjectService projectService;

    /**
     * 项目配置搜索
     *
     * @return
     */
    @PostMapping("/search")
    @ApiOperation("项目配置查询")
    public ResultResponseMsg search(@RequestBody ProjectVo project) {
        ProjectDto projectDto = BeanConverterUtil.convertToBean(project, ProjectDto.class);
        return ResultResponseMsg.buildSuccessResultMsg(projectService.search(projectDto));
    }

}